<template>
  <div id="user">
    <!-- 登录 -->
    <div class="user">
      <div class="user-touxiang">
        <img v-show="imgshow" src="../assets/img/me.jpg" alt="" width="100%"
        style="border-radius: 50%;">
      </div>
      <div class="user-dl">
        <p style="font-size:0.45rem" @click="gologin">{{dl}}</p>
        <p class="user-dl-jf">积分:0</p>
        <p v-show="dlshow" @click="del">退出登录</p>
      </div>
    </div>
    <!-- 通知栏 -->
    <van-notice-bar left-icon="volume-o" text="在代码阅读过程中人们说脏话的频率是衡量代码质量的唯一标准。" />
    <div class="my-dingdan">
      <p>
        <span class="my-span-one">
          <van-icon name="balance-list-o" color="orange" size="0.3rem" />
          <span style="font-size:0.25rem">我的订单</span>
        </span>
        <span>></span>
      </p>
      <div class="ME">
        <icon v-for="(item, index) in icon" :key="index" :title="item.title" :icon="item.icons" />
      </div>
    </div>
    <!-- 我的余额 -->
    <div class="mony">
      <icon v-for="(item, index) in mony" :key="index" :title="item.title" :icon="item.icons" />
    </div>
  </div>
</template>

<script>
import icon from "../components/icon";
export default {
  components: {
    icon
  },
  data() {
    return {
      //订单数组
      icon: [
        {
          icons: "paid",
          title: "待付款"
        },
        {
          icons: "send-gift-o",
          title: "待发货"
        },
        {
          icons: "logistics",
          title: "待收货"
        },
        {
          icons: "comment-o",
          title: "待评价"
        }
      ],
      //余额数组
      mony: [
        {
          icons: "paid",
          title: "我的余额"
        },
        {
          icons: "send-gift-o",
          title: "我的砍价"
        },
        {
          icons: "logistics",
          title: "我的礼券"
        },
        {
          icons: "comment-o",
          title: "我的收藏"
        },
        {
          icons: "comment-o",
          title: "我的地址"
        },
        {
          icons: "comment-o",
          title: "联系客服"
        }
      ],
      dl: "立即登录",
      dlshow:true,
      it:[],
      imgshow:false,
    };
  },

  created() {

    let it = localStorage.it;
    if (it) {
       this.it=JSON.parse(it)
      this.dl = "13500000000";
      this.imgshow=true
    }
    if(!it){
      this.dlshow=false
    }
    
      
   
  },
  methods:{
    del(){
      this.dlshow=false
      this.dl="立即登录"
      this.imgshow=false
      window.localStorage.removeItem("it")
    },
    gologin(){
      if(this.dl=="立即登录"){
        this.$router.push("/userlogin")
      }
    }
  }
};
</script>

<style scoped>
#user {
  background: rgb(250, 248, 248);
}
.user {
  width: 100%;
  height: 3.12rem;
  background: #c1b18f;
  display: flex;
  justify-content: left;
  align-items: center;
  padding: 0 10px;
}
.user-touxiang {
  width: 1.6rem;
  height: 1.6rem;
  background: white;
  border-radius: 50%;
}
.user-dl {
  margin-left: 0.2rem;
}
.user-dl p {
  color: white;
  height: 0.8rem;
  line-height: 0.8rem;
}
.user-dl p a {
  color: white;
}
.user-dl-jf {
  width: 2rem;
  height: 0.5rem !important;
  line-height: 0.5rem !important;
  color: #fff;
  background: #b3a078;
  border-radius: 0.0694444444rem;
  opacity: 0.8;
  font-size: 0.2rem;
  padding: 0 0.2rem;
}
.van-notice-bar {
  background: white;
  color: red;
}
.my-dingdan {
  background: white;
  margin-top: 0.3rem;
}
.my-dingdan p {
  height: 0.7rem;
  padding: 0.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 0.001rem solid rgb(145, 142, 142);
}
.my-dingdan p > .my-span-one {
  width: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ME {
  width: 100%;
  display: flex;
  justify-content: space-around;
  font-size: 0.2rem;
  color: gray;
}
.mony {
  width: 100%;
  margin-top: 0.3rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  background: white;
}
.mony > div {
  width: 33%;
  height: 1.8rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.2rem;
  
}
</style>